Skip to content

Conversation

@jh-db
Copy link

@jh-db jh-db commented Oct 24, 2025

Changes

  • Add a new experimental_is_unified_host flag to auth commands and persist it in profiles
  • Prompt for optional Workspace ID when logging in to a unified host.

Depends on databricks/databricks-sdk-go#1307 and won't build without those SDK changes being released first

Why

Unified hosts support both workspace and accounts APIs. Support for this required making some changes to the Go SDK, which the cli relies on.

Tests

Not tested yet

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Oct 24, 2025

Run: 19098566197

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip
💚​ aws linux 1 1 326 591
💚​ aws windows 1 1 327 590
💚​ aws-ucws linux 1 1 449 486
💚​ aws-ucws windows 1 1 450 485
💚​ azure linux 1 1 326 590
💚​ azure windows 1 1 327 589
💚​ azure-ucws linux 1 1 445 485
💚​ azure-ucws windows 1 1 446 484
💚​ gcp linux 1 1 325 592
💚​ gcp windows 1 1 326 591
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
TestAccept/bundle/run/app-with-job 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S

@jh-db jh-db requested a review from pietern October 30, 2025 09:38
@@ -233,7 +241,7 @@ depends on the existing profiles you have set in your configuration file
// 1. --account-id flag.
// 2. account-id from the specified profile, if available.
// 3. Prompt the user for the account-id.
func setHostAndAccountId(ctx context.Context, existingProfile *profile.Profile, authArguments *auth.AuthArguments, args []string) error {
func setHostAndAccountId(ctx context.Context, cmd *cobra.Command, existingProfile *profile.Profile, authArguments *auth.AuthArguments, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to take cmd if you can stick this property in the auth arguments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I didn't notice because I added cmd first, and then changes authArguments later when I realized I needed it there.

}

prompt := cmdio.Prompt(ctx)
prompt.Label = "Databricks workspace ID (optional - provide only if using this profile for workspace operations, leave empty for account operations)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there not a way to detect this?

Copy link
Contributor

@renaudhartert-db renaudhartert-db Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean infer and decide whether this should be used or not based on the operation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the cli api command and some code in TF relies on being able to tell whether a config is a workspace config or an account config before making a call. We originally wanted to make it possible to use the same profile/config for account and workspace calls, but since the code needs a way to distinguish them, we opted to make workspaceId required for unified workspace profiles, and forbid its presence in unified account profiles.

target := &u2m.InvalidRefreshTokenError{}
if errors.As(err, &target) {
oauthArgument, err := AuthArguments{host, accountId}.ToOAuthArgument()
oauthArgument, err := AuthArguments{host, accountId, false}.ToOAuthArgument() // TODO: pass the IsUnifiedHost flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] use field names, this makes the code more robust in case of refactoring.

Suggested change
oauthArgument, err := AuthArguments{host, accountId, false}.ToOAuthArgument() // TODO: pass the IsUnifiedHost flag
oauthArgument, err := AuthArguments{
Host: host,
AccountID: accountId,
Experimental_IsUnifiedHost: false,
}.ToOAuthArgument() // TODO: pass the IsUnifiedHost flag

}
host := cfg.CanonicalHostName()
if cfg.IsAccountClient() {
if cfg.GetHostType() == config.AccountHost {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer exhaustive switch.

@@ -233,7 +241,7 @@ depends on the existing profiles you have set in your configuration file
// 1. --account-id flag.
// 2. account-id from the specified profile, if available.
// 3. Prompt the user for the account-id.
func setHostAndAccountId(ctx context.Context, existingProfile *profile.Profile, authArguments *auth.AuthArguments, args []string) error {
func setHostAndAccountId(ctx context.Context, cmd *cobra.Command, existingProfile *profile.Profile, authArguments *auth.AuthArguments, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@jh-db jh-db force-pushed the jh-db/unified-hosts branch from 8263dd2 to 9b5df04 Compare November 3, 2025 10:50
@jh-db jh-db temporarily deployed to test-trigger-is November 3, 2025 10:50 — with GitHub Actions Inactive
@jh-db jh-db force-pushed the jh-db/unified-hosts branch from 9b5df04 to 8539eba Compare November 5, 2025 09:23
@jh-db jh-db temporarily deployed to test-trigger-is November 5, 2025 09:23 — with GitHub Actions Inactive
@jh-db jh-db temporarily deployed to test-trigger-is November 5, 2025 10:12 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants